home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / comm / net / amitcp_ups10.lha / ups-sendmail.c < prev    next >
C/C++ Source or Header  |  1993-10-10  |  735b  |  42 lines

  1.  
  2. /*
  3.  * Replace this with your own version or a real sendmail if
  4.  * available
  5.  *
  6.  * This program will be called as \'ups-sendmail <parameters>\'
  7.  * and it will get the mail from stdin.
  8.  */
  9.  
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12.  
  13. #ifndef BUFSIZ
  14. #define BUFSIZ 256
  15. #endif
  16.  
  17. int main(int argc, char *argv[])
  18. {
  19.     char buf[BUFSIZ];
  20.     FILE *out;
  21.     int l;
  22.  
  23.     if(argc < 2)
  24.     exit(1);
  25.     out = fopen("con:10/10/600/200/UPS-Sendmail/AUTO/WAIT/CLOSE/INACTIVE", "w");
  26.     if(!out)
  27.     exit(1);
  28.  
  29.     fprintf(out, "Mail arrived (");
  30.     for(l=1; l<argc; l++)
  31.     fprintf(out, "%s ", argv[l]);
  32.     fprintf(out,")\n\n");
  33.  
  34.     while(l = fread(buf, sizeof(char), BUFSIZ, stdin))
  35.     {
  36.     fwrite(buf, sizeof(char), l, out);
  37.     }
  38.     fclose(out);
  39.  
  40.     
  41. }
  42.